package com.bjpowernode.appio;
import java.io.*;
//1——方向（参照物内存）【进入内存为输入：input】【内存到其他地方为输出：output】
//2——单位【字节（二进制）input、output】【字符（中文）Reader、Writer】
//3——功能【连接】【过滤】
//java.io为IO流操作的包
public class MyApp1 {
    public static void main(String[] args) {

        String temp = "";

        byte[] bytes = new byte[4];


        try {
            FileInputStream fileInputStream = new FileInputStream("D:\\aa.txt");
            //byte[] b字节缓存
            //int off
            //int len
            //return 返回的是目前总数据量，如果没有则为-1
            int read = 0;
            StringBuffer stringBuffer = new StringBuffer();
            while ((read = fileInputStream.read(bytes, 0, bytes.length)) != -1) {
                String temp2 = new String(bytes, 0, read);
                stringBuffer.append(temp2);
            }
            temp=stringBuffer.toString();
            fileInputStream.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


        System.out.println(temp);


    }
}
